package com.qk.management.mapper;

import com.qk.dto.role.RoleDTO;
import com.qk.entity.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 *
 *
 * @author blusr
 * @version 1.0
 * @date 2025/10/7 19:50
 */
@Mapper
public interface RoleMapper{
    @Select("select label from t_role where id = #{userId}")
    String selectByUserId(Integer userId);

    List<Role> list(RoleDTO roleDto);

    @Insert("insert into t_role(name, label, remark, create_time, update_time) values(#{name}, #{label}, #{remark}, #{createTime}, #{updateTime})")
    void addRole(Role role);

    @Delete("delete from t_role where id = #{id}")
    void deleteRole(Long id);

    @Select("select * from t_role where id = #{id}")
    Role getRole(Long id);

    void updateRole(Role role);

    @Select("select * from t_role")
    List<Role> getRoles();
}
